<?php
			
	class LoginController extends ApplicationController {

		function index(){
			$login=1;
			$password=1;
			Session::set_data('login',$login);
			Session::set_data('password',$password);

		}
		
		function inicio_sesion(){
		$login= $this->request("login");
		$password=$this->request("password");
		$password= sha1($password);
		
		$auth = new Auth("model", "class: Usuarios", "login: $login", "password: $password");
		
		
		if($auth->authenticate()){
			$usuario=$auth->get_identity();
			
			Flash::success("Bienvenido {$usuario->nombre}");
			$this->route_to("controller: plandepago");
		} else {
		Flash::error("usuario/password invalido");
		$this->login=$login;
		$this->route_to("action: index");
		}
		
		}

		function iniciar_sesion(){
			
			
				}
		function cerrar_sesion(){
					
		$this->route_to("controller:login ","action: index");
		Flash::error("Usted ha salido correctamente.");
			
		}
		
		function recibe(){
			
			
		}	
		

	}
	
?>

